<?php
using("Expression_Expression");
using("Expression_Exception");

class Expression_Operand implements Expression_Expression {
	
	/**
	 * Value which will be a leaf in the expression tree
	 *
	 * @var String
	 */
	private $_value;
	
	/**
	 * Construct a new operand with the given value
	 * 
	 * @throws Expression_Exception if a type other than string is passed
	 *
	 * @param String $value
	 */
	public function __construct($value) {
		try {
			$this->_value = $value;
		} catch (Exception $e) {
			throw new Expression_Exception($e);
		}
	}
	
	public function evaluate() {
		return $this->_value;
	}
	
	public function __toString() {
		return $this->evaluate();
	}
}
?>